package com.qolome.knowledge.design.pattern.adapter.demo.passport;


import com.qolome.knowledge.design.pattern.adapter.demo.passport.adapters.ILoginAdapter;


public abstract class AbstractPassportForThirdAdapter implements IPassportForThird{

    public ResultMsg processLogin(String id,Class<? extends ILoginAdapter> clazz){
        try {
            // TODO The method newInstance() from the type Class<capture#1-of ? extends ILoginAdapter> is deprecated since version 9
            ILoginAdapter adapter = clazz.newInstance();
            if (adapter.support(adapter)){
                return adapter.login(id,adapter);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
